home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / icons+tools / icontools-2.01 / memfn.c < prev    next >
C/C++ Source or Header  |  1995-12-22  |  865b  |  33 lines

  1. /* $Id: memfn.c,v 1.1 1994/02/03 04:10:27 tf Exp $ */
  2.  
  3. #ifndef lint
  4. static char vcid[]= "$Id: memfn.c,v 1.1 1994/02/03 04:10:27 tf Exp $";
  5. #endif /* lint */
  6.  
  7. #define DEF_BITWISE_MEM_FUNCTION( NAME, FUNC )  \
  8. char *                                          \
  9. NAME(to,from,n)                                 \
  10. char *to, *from;                                \
  11. unsigned n;                                     \
  12. {                                               \
  13.   for(;n;n--)                                   \
  14.     *to++ FUNC *from++;                         \
  15.                                                 \
  16.   return to;                                    \
  17. }
  18.  
  19. DEF_BITWISE_MEM_FUNCTION(memand,&=)
  20. DEF_BITWISE_MEM_FUNCTION(memor,|=)
  21. DEF_BITWISE_MEM_FUNCTION(memandnot,&=~)
  22.  
  23. char *
  24. memnot(to,n)
  25. char *to;
  26. unsigned n;
  27. {
  28.   for(;n;n--)
  29.     *to++ ^= ~0L;
  30.  
  31.   return to;
  32. }
  33.